import { api, safe } from '@/lib/api'; import { fmtInt } from '@/lib/format'; import { OG_CONTENT_TYPE, OG_SIZE, renderSiteOg, renderTopicOg } from '@/lib/og'; import { SITE_NAME } from '@/lib/site'; /** Industry share image: name, description, monitored companies, activity counters. */ export const alt = `Industry on ${SITE_NAME}`; export const size = OG_SIZE; export const contentType = OG_CONTENT_TYPE; export default async function IndustryOpenGraphImage({ params }: { params: Promise<{ slug: string }> }) { const { slug } = await params; const d = await safe(api.industry(slug)); if (!d) return renderSiteOg(await safe(api.stats())); const list = Array.isArray(d.companies) ? d.companies : []; const count = Array.isArray(d.companies) ? d.companies.length : d.companies; return renderTopicOg({ eyebrow: 'Industry', title: d.name, subtitle: d.description, names: list.map((c) => c.display_name), counters: [ ['Companies', fmtInt(count)], ['Events 7d', fmtInt(d.events_7d)], ['Events 30d', fmtInt(d.events_30d)], ['Open jobs', fmtInt(d.hiring?.open)], ], path: `/industry/${d.slug}`, }); }